<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../include.jsp" %>

<html>
<head>	

	<script type="text/javascript"> 
		function fnAnswerInit() {
			$("#id_answer_0, #id_answer_1, #id_answer_2, #id_answer_3, #id_answer_4, #id_answer_5, #id_answer_6, #id_answer_7, #id_answer_8, #id_answer_9").hide();
		}
		
		// 화면 전환
		function fnAnswerOpen(strId) {
			fnAnswerInit();
			$("#"+strId).show();
		}
		
		// 수정
		function fnFaqEdit(atcNo) {
			location.href = '/board/edit/BBS_ID/${objBbsInfo.bbsId}/ATC_NO/' + atcNo;
		}
		
		// 삭제
		function fnFaqRemove(atcNo) {
			if (confirm("<spring:message code="board.msg.contents.remove"/>")) {
				location.href = '/board/remove/BBS_ID/${objBbsInfo.bbsId}/ATC_NO/' + atcNo;
			}
		}
	</script>	
	
	
	<script type="text/javascript">        
	var $ = jQuery.noConflict();	

	$(document).ready(function() {
		// FAQ 리스트 초기화
		fnAnswerInit();
		
		// 첫번째 항목을 기본적으로 펼져준다.
		$("#id_answer_0").show();
				
		// 등록
		$("#id_btn_add").click(function(e) {
			e.preventDefault();
			location.href = '/board/add/BBS_ID/${objBbsInfo.bbsId}';
		});
		
	});
    </script>
</head>
<body>

	<h3>${objBbsInfo.bbsNm}</h3>

	<b>${objBbsInfo.bbsDesc}</b>
	<br><br>
	
	<spring:message code="board.msg.faq.info"/><br>
	<spring:message code="board.msg.faq.conn"/>
	<br><br>


	
	<div class="tbl_type1">				
		
		<table cellspacing="0" cellpadding="0" border="0">
			<colgroup>
				<col width="50">
				<col>
				<col width="80">
			</colgroup>
			
			<c:if test="${!empty objArticleList}">
			<c:forEach items="${objArticleList}" var="objArticle" varStatus="i">
			<tr>
				<td><img src="/img/faq_q.gif"></td>
				<td style="text-align:left;">				
					<b><a href="#" onClick="fnAnswerOpen('id_answer_${i.index}');" class="none_color">${objArticle.ttl}</a></b>
				</td>
				<td style="text-align:right;">
					<sec:authorize ifAllGranted="ROLE_ADMIN, ROLE_MANAGER">
						<a href="#" onClick="fnFaqEdit('${objArticle.atcNo}');" class="btn_xsml"><span><spring:message code="button.edit"/></span></a>
						<a href="#" onClick="fnFaqRemove('${objArticle.atcNo}');" class="btn_xsml"><span><spring:message code="button.delete"/></span></a>
					</sec:authorize>
				</td>
			</tr>
			<tr id="id_answer_${i.index}">
				<td>&nbsp;</td>
				<td colspan="2" style="text-align:left;">
					${objArticle.cont}
				</td>
			</tr>
			</c:forEach>
			</c:if>
			
		</table>	

	</div>	


	
		
	<br><br> 
	<div style="text-align:center;">
		<a href="#" id="id_btn_add" class="btn_big"><strong><spring:message code="button.registor"/></strong></a>
	</div>
	
</body>
</html>